<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0,
           maximum-scale=1.0, minimum-scale=1.0"/>
    <title>angular($resouce)</title>
    <script src="js/angular.js"></script>
    <script src="http://cdn.bootcss.com/angular-resource/1.5.8/angular-resource.min.js"></script>
</head>
<body>
<!-- 初始化中全部是以key=value来书写的 -->
<div ng-app="app">

    <div ng-controller="fourController">
        {{name.name}}
    </div>

</div>
</body>

<script>
    /*
    * $resource服务，用于显示做接口请求，优于$http服务
    * */
    var app=angular.module('app',['ngResource']);
    app.controller('fourController',['$scope','$resource', function ($scope,$resource) {
        var obj=$resource('page.json');
        $scope.name=obj.get({name:'lisi'}, function (data) {
            console.log(data.name);
        }, function () {

        });
    }]);
</script>
</html>